home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 30
/
PC Gamer IT CD 30 1-2.iso
/
MOTS
/
GAMEDATA
/
RESOURCE
/
JKMRES.GOO
/
cog_actor_st_pnch.cog
< prev
next >
Wrap
Text File
|
1998-02-25
|
5KB
|
178 lines
# Jedi Knight Cog Script
#
# ACTOR_ST.COG
#
# ACTOR SCRIPT - Standard Stormtrooper
#
# 7/28/97 [CR] Doubled saber damage for single player gameplay reasons
#
# [CYW, YB & CR]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
symbols
message killed
message damaged
message skill
message timer
int oldAIMode local
int isFrozenNow=0 local
flex extraFreezeTime=0.0 local
template powerup=+DSTrifle local
template limb=+stormlimb local
int newThing local
int victim local
int bin local
int senderref=-1 local
ai flee_ai=noweapon.ai local
ai punch_ai=st_punch.ai local
int damage local
vector currentpos local
end
# ========================================================================================
code
damaged:
damage = GetParam(0);
if(GetParam(1) == 16) // saber damage might cause dismemberment
{
damage = (damage * 2.0);
victim = GetSenderRef();
if(GetThingHealth(victim) <= damage) // but only if damage is sufficient to kill
{
if(rand() < 0.05) // random chance
{
AmputateJoint(victim, 5);
newThing = CreateThingAtPos(limb, GetThingSector(victim), GetThingPos(victim), '0 0 0');
SetThingVel(newThing, '0.0 0.7 1.4');
}
}
}
ReturnEx(damage);
return;
# ........................................................................................
killed:
victim = GetSenderRef();
if(GetActorWeapon(victim, 1) != -1)
{
AmputateJoint(victim, 3);
newThing = CreateThing(powerup, victim);
SetLifeleft(newThing, 200.0);
}
return;
# ........................................................................................
skill:
bin = GetParam(0);
if(bin == 24) // Force Pull
{
// he's a fighter, not a fleer... -srs
senderref = GetSenderRef();
// If he hasn't been pulled yet...
if (GetActorWeapon (senderref, 1) != -1)
{
SetActorWeapon(senderref, 1, -1);
newThing = CreateThing(powerup, GetSenderRef());
SetLifeleft(newThing, 30.0);
AISetClass (senderref, punch_ai);
AISetMode(senderref, 0x4);
ReturnEx(newThing);
}
else
{
// Give the actor a shove towards the player.
currentpos = VectorSub(GetThingPos(GetLocalPlayerThing(), senderref));
currentpos = VectorScale(VectorNorm(currentPos), 250);
ApplyForce(senderref, currentpos);
ReturnEx(-1);
}
//AIFlee(senderref, GetLocalPlayerThing());
Return;
}
else
if(bin == 31) // Force Grip
{
ReturnEx(10); // return base damage that is taken by this actor.
Return;
}
else
if(bin == 34) // Deadly Sight
{
ReturnEx(10); // return base damage that is taken by this actor.
Return;
}
// else
// if(bin == 1035) // Carbonite
// {
// if (!isFrozenNow)
// {
// senderref = GetSenderRef();
// victim = GetParam(2);
//
// isFrozenNow = 1;
// extraFreezeTime = 0.0;
//
// oldAIMode = AIGetMode(victim);
// AISetMode(victim, 0x2000); // Disable the actor's AI.
// AISetMoveThing(victim, victim); // Set the thing as it's own destination so it stops moving.
//
// SetTimerEx(GetParam(1), 1035, victim, 0); // Make an appointment for "Unthawing"
// }
// else
// {
// extraFreezeTime = extraFreezeTime + GetParam(1);
// }
//
// ReturnEx(0);
// return;
// }
ReturnEx(-1);
return;
# ........................................................................................
timer:
senderref = GetSenderRef();
if(GetSenderId() == 1035) // Thaw out
{
victim = GetParam(0);
if (!extraFreezeTime)
{
AIClearMode(victim, 0xFFFFFFFF);
AISetMode(victim, oldAIMode); // Reinstate the actor's AI.
isFrozenNow = 0;
}
else
{
// We've been hit more than once, so we need to extend the freeze time.
SetTimerEx(extraFreezeTime, 1035, victim, 0); // Make an appointment for "Unthawing"
extraFreezeTime = 0.0;
}
}
Return;
end